import request from '@/utils/request'

export function getAllattendance() {
  return request({
    url: '/Attendance/selectAll',
    method: 'get'
  })
}
export function updateattendance(attendance) {
  return request({
    url: '/Attendance/updateByPrimaryKeySelective',
    method: 'put',
    params: {
      checkId: attendance.checkId, // 考勤编号
      checkName: attendance.checkName, // 考勤名称
      checkAdminUserId: attendance.checkAdminUserId,
      checkAdminUserName: attendance.checkAdminUserName, // 考勤管理员姓名
      checkList: attendance.checkList, // 考勤所属标题
      checkStatus: attendance.checkStatus, // 考勤状态
      checkSemId: attendance.checkSemId, // 考勤所属学期
      checkPosition: attendance.checkPosition, // 考勤位置
      checkRemark: attendance.checkRemark, // 考勤备注信息
      checkStartTime: attendance.checkStartTime, // 考勤开始时间
      checkStopTime: attendance.checkStopTime, // 考勤结束时间
      checkScore: attendance.checkScore, // 考勤分数
      checkQrcode: attendance.checkQrcode,
      checkLongitude: attendance.checkLongitude,
      checkLatitude: attendance.checkLatitude
    }
  })
}

export function deleteessay(checkId) {
  return request({
    url: '/Attendance/deleteByPrimaryKey',
    method: 'post',
    params: {
      checkId: checkId
    }
  })
}

export function getattendanceById(checkId) {
  return request({
    url: '/Attendance/selectById',
    method: 'get',
    params: {
      checkId: checkId
    }
  })
}

export function addessay(attendance) {
  return request({
    url: '/Attendance/insertSelective',
    method: 'post',
    params: {
      checkName: attendance.checkName, // 考勤名称
      checkList: attendance.checkList, // 考勤所属标题
      checkListId: attendance.checkListId, // 考勤标题编号
      checkStatus: attendance.checkStatus, // 考勤状态
      checkSemId: attendance.checkSemId, // 考勤所属学期
      checkPosition: attendance.checkPosition, // 考勤位置
      checkRemark: attendance.checkRemark, // 考勤备注信息
      checkStartTime: attendance.checkStartTime, // 考勤开始时间
      checkStopTime: attendance.checkStopTime, // 考勤结束时间
      checkScore: attendance.checkScore, // 考勤分数
      checkAdminUserId: attendance.checkAdminUserId,
      checkAdminUserName: attendance.checkAdminUserName, // 考勤管理员姓名
      checkLongitude: attendance.checkLongitude,
      checkLatitude: attendance.checkLatitude
    }
  })
}

// 根据学期id、所属标题、标题编号返回数据
export function selectByCheckSemIdAndCheckListAndCheckListId(CheckSemId, checkList, checkListId) {
  return request({
    url: '/Attendance/selectByCheckSemIdAndCheckListAndCheckListId',
    method: 'get',
    params: {
      CheckSemId: CheckSemId,
      checkList: checkList,
      checkListId: checkListId
    }
  })
}

